/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __MAIN_WORLD_H__
#define __MAIN_WORLD_H__

#include "Ogre.h"
#include "OIS/OIS.h"

#include "SinbadCharacter.h"
#include "SceneObject.h"

namespace PQGame
{
	//recent character test
	class MainWorld
		: public OIS::MouseListener, public OIS::KeyListener
	{
	public:
		static const Ogre::String DATA_PATH;
		static const Ogre::String GROUP_NAME;

	public:
		static MainWorld &getSingleton();
		void init(PQEngine::SceneObject* sceneObject);
		void update(float deltaT);

		void initInputListener();
	protected:
		bool keyPressed( const OIS::KeyEvent &e );
		bool keyReleased( const OIS::KeyEvent &e );

		bool mouseMoved( const OIS::MouseEvent &e );
		bool mousePressed( const OIS::MouseEvent &e, OIS::MouseButtonID id );
		bool mouseReleased( const OIS::MouseEvent &e, OIS::MouseButtonID id );
	protected:
		MainWorld(void);
		~MainWorld(void);
	private:
		PQEngine::SceneObject* _sceneObject;
		SinbadCharacter *character;

		bool rightMouseDown;
		void createMainCharacter();

		float getTerrainHeight(const float x, const float z);
		void setupScene();

		void setupGUI();
		void initResource();

	};
}
#define SMainWorld PQGame::MainWorld::getSingleton()

#endif
